{template header}
<link rel="stylesheet" href="static/calendar/js/calendar.css" />
<script type="text/javascript" charset="utf-8" src="static/calendar/calendar.php"></script>

<form enctype="multipart/form-data" method="post" action="" class="form-horizontal">
    <div class="control-group">
        <label class="control-label">开始时间：</label>
        <div class="controls">
            <input type="text" name="begintime" id="start_time_id" value="{eval echo date('Y-m-d H:i:s', $begintime)}">
            <input type="button" id="start_time_btn" onclick="return showCalendar('start_time_id', '%Y-%m-%d %H:%M:%S', '24', false, 'start_time_btn');" value="选择" class="button" id="start_time_id"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">结束时间：</label>
        <div class="controls">
            <input type="text" name="endtime" id="end_time_id" value="{eval echo date('Y-m-d H:i:s', $endtime)}">
            <input type="button" id="end_time_btn" onclick="return showCalendar('end_time_id', '%Y-%m-%d %H:%M:%S', '24', false, 'end_time_btn');" value="选择" class="button" id="end_time_id"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">完赛勋章发放组(,分隔)：</label>
        <div class="controls">
            <textarea rows="3" cols="20" name="wansai"></textarea>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">擂主勋章发放组(,分隔)：</label>
        <div class="controls">
            <textarea rows="3" cols="20" name="leizhu"></textarea>
        </div>
    </div>
    <div class="control-group">
        <div class="controls">
            <input type="hidden" name="doGive" value="1" />
            <button type="submit" class="btn">发放</button>
        </div>
    </div>
</form>
<script type="text/javascript">
    $(function() {
        $('.form-horizontal').on('submit', function(){
           if ($('#start_time_id').val() == '' || $('#end_time_id').val() == '') {
               alert('时间段不能为空');
               return false;
           }
           
           if ($('textarea[name="wansai"]').val() == '' && $('textarea[name="leizhu"]').val() == '') {
               alert('请填入有效的组ID');
               return false;
           }
        });
    })
</script>
{template footer}
